﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace PurchaseSales.Manage.Common.Extensions
{
    public static class DelegeteExtension
    {
        public static void SafeInvoke<T>(this T t, Action<T> action) where T : class
        {
            if (t != default(T) && action != null)
                action.Invoke(t);
        }

        public static void SaftyInvoke<T>(this T t, Action<T> action)
        {
            if (t is T && action != null)
                action.Invoke(t);
        }

    }
}
